package com.dlc.shop.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dlc.shop.bean.model.UserWithdrawCash;
import com.dlc.shop.bean.vo.UserWithdrawCashVO;
import com.dlc.shop.bean.vo.UserWithdrawInfoVO;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author gaozijie
 * @date 2023-04-24
 */
public interface UserWithdrawCashMapper extends BaseMapper<UserWithdrawCash> {

    /**
     * 新增
     * @param withdrawCash
     */
    void save(@Param("withdrawCash") UserWithdrawCash withdrawCash);

    /**
     * 更新
     * @param withdrawCash
     */
    void update(@Param("withdrawCash") UserWithdrawCash withdrawCash);

    /**
     * 通过orderNo获取提现记录
     * @param orderNo 订单号
     * @return
     */
    UserWithdrawCash getByOrderNo(@Param("orderNo") String orderNo);

    /**
     * 统计指定时间内提现次数
     * @param userId 用户id
     * @param startTime 起始时间
     * @return
     */
    Integer countWithdrawTimes(@Param("userId") String userId,
                               @Param("startTime") LocalDateTime startTime);

    /**
     * 获取用户提现总金额
     * @param userId
     * @return
     */
    BigDecimal getTotalWithdrawAmount(@Param("userId") String userId);

    /**
     * 获取用户提现记录
     * @param userId
     * @return
     */
    List<UserWithdrawCashVO> listUserWithdrawCashVOList(@Param("userId") String userId);

    /**
     * 获取用户提现信息
     * @param userId 用户id
     * @return
     */
    UserWithdrawInfoVO getUserWithdrawInfo(String userId);
}
